package com.avengers.core.bean.enums;

/**
 * @author yu.wang
 * @since 2018-08-15 上午11:07
 */
public enum Charset {
    // utf-8
    UTF8("utf-8"),
    GBK("gbk"),
    GB2312("gb2312"),
    iso("ISO-8859-1");

    public final String value;

    Charset(String value) {
        this.value = value;
    }

    public static Charset fromValue(String value) {
        for (Charset charset : values()) {
            if (charset.name().equalsIgnoreCase(value) || charset.value.equalsIgnoreCase(value)) {
                return charset;
            }
        }
        return null;
    }
}
